<?php

namespace app\admin\model;

use think\Model;

class Category extends Model
{
    // 表名
    protected $name = 'category';

    //默认隐藏字段
    protected $hidden = [
        'lock_client_id',
        'lock_client_secret',
        'lock_username',
        'lock_password',
        'message_name',
        'message_secret',
        'end_time_min',
        'end_time_content',
        'hall_lock_id'
    ];

    //类型转换 lat lng price 为float
    protected $type = [
        'lat' => 'float',
        'lng' => 'float',
        'price' => 'float',
    ];


    //一对多关联 提取门店专属的充值赠送规则
    public function rechargeRule()
    {
        return $this->hasMany(RechargeRule::class,'category_id','id');
    }


    //一对多 提取门店专属的问答faq
    public function faq()
    {
        return $this->hasMany(Faq::class,'category_id','id');
    }

    //一对多 提取门店专属的order_proc_help
    public function orderProcHelp()
    {
        return $this->hasMany(OrderProcHelp::class,'category_id','id');
    }

    //本记录belongs to MeituanAuth
    public function meituanAuth()
    {
        return $this->belongsTo(MeituanAuth::class,'meituan_auth_id','id');
    }

}
